<?php


//Import Response Class
require_once 'lib/raspuns.php';

//Creating User Class
class Investitie {

	var $nume;

}
//Make DB connection
require_once ('../conexiune_bazadedate.php');
//Query BD
if (isset ($_GET['start']))
	$offset = $_GET['start'];
else
	$offset = 0;

$limit = $_GET['limit'];

$result = mysql_query("SELECT nume FROM investitii LIMIT $offset, $limit");

$totalquery = mysql_query("SELECT COUNT(*) FROM investitii");
$total = mysql_fetch_array($totalquery);
$total = ($total[0]);
$query_array = array ();
$i = 0;

while ($row = mysql_fetch_array($result)) {

	$Investitie = new Investitie();

	$Investitie->nume = $row['nume'];

	$query_array[$i] = $Investitie;
	$i++;

}

mysql_close($con);

//Creating Json Array needed for Extjs Proxy
$res = new Raspuns();
$res->success = true;
$res->message = "Loaded data";
$res->total = $total;
$res->data = $query_array;
//Printing json ARRAY
print_r($res->to_json());
?>